#include <iostream>
using namespace std;
typedef long long ll;
ll Gcd(ll power, ll x)
{
    ll _max = max(power, x);
    ll _min = min(power, x);
    ll rem = _max % _min, tmp = _min, gcd = rem;

    while (rem)
    {
        gcd = rem;
        rem = tmp % gcd;
        tmp = gcd;
    }
    return gcd;
}

int main()
{
    ll n, power;
    cin >> n >> power;

    ll x = 0;
    while (n--)
    {
        cin >> x;
        if (power >= x)
            power += x;
        else
            power += Gcd(power, x);
    }
    cout << power << endl;
    return 0;
}